<%-- 
    Document   : actiontotalTour
    Created on : Nov 14, 2012, 5:23:11 PM
    Author     : Nguyen Hung
--%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%@taglib prefix="rich" uri="http://richfaces.org/rich" %>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <script type="text/javascript" language="javascript">
        var open_cur = 0;
        $j = jQuery.noConflict();
        $j(document).ready(function(){
            $j(".abcdelete" ).click(function() {
                $j(this).parent().parent().parent().parent().hide();
                     
            });
            $j(".savencc" ).live('click',function() {
                alert("alo");
                  e = "0935646648";
                  message = "alo";
//                $j.ajax({
//                  
//                    url: "http://center.fibosms.com/Service.asmx/SendSMS?",
//                    type: "POST",
//                    data: {clientNo:"CL7793", clientPass:"ntis@sale@1234", phoneNumber:e, smsMessage:message, smsGUID:1,serviceType:4684},
//                    dataType: "json",
//                    beforeSend: function(x) {                                                   
//                        if (x && x.overrideMimeType) {
//                            x.overrideMimeType("application/j-son;charset=UTF-8");
//                        }
//                    },
//                    complete: function(data){
//                        alert(data);
//                    },
//                        						
//                    success: function( strData ){
//                                                        
//                    }
//                });	
                               $j.post('http://center.fibosms.com/Service.asmx/CheckClient?clientNo=CL7793&clientPass='+"ntis@sale@1234",function(data){
                                   
                               });
                     
            });
        });
        function countChar(val) {
            var len =  val.value.length;   
            if (len <= 320 && len >= 0) {             
                var i = 320 - len;  
                   
                $j('.sgt_sms_warming').text("Còn "+i+" kí tự"); 
                $j('.sms_alert').addClass("displaynone")  
                $j('.hiddenSend').removeClass("displaynone");
                //                     alert(i);
            }else {
                $j('.sms_alert').removeClass("displaynone")  
                $j('.hiddenSend').addClass("displaynone");
            }
        };
    </script>
    <style>
        .sms_alert{
            color: red;
            width: 100%;
            text-align: center;
            float: left;


        }
        .displaynone{
            display:none; 

        }
        .inputSMS{
            background-color: #414D5A;
            color: #FFFFFF;
            float: left;
            height: 20px;
            margin-bottom: 1px;
            padding: 1%;
            width: 98%;

        }
        .inputSMS1{
            background-color: #414D5A;
            color: #FFFFFF;
            float: left;
            height: 102px;
            margin-bottom: 1px;
            padding: 1%;
            width: 98%;
        }
        .inputSMS select{
            margin-left: 9px;
            float: left;
        }
    </style>
    <body>
        <f:view>
            <a4j:form id="sendsms">
                <a4j:status onstart="#{rich:component('statPane')}.show()" onstop="#{rich:component('statPane')}.hide()" />
                <h:panelGroup id="abcd">
                    <div class="inputSMS">
                        <h:panelGroup rendered="#{templateController.group==1}">  <h:outputText style="float:left;width:40%;" value="SỐ NGƯỜI GỬI : 1(#{templateController.phone})"/></h:panelGroup>
                        <h:panelGroup rendered="#{templateController.group==0}">  <h:outputText style="float:left;width:40%;" value="SỐ NGƯỜI GỬI : #{templateController.numberSMS}"/></h:panelGroup>
                        <h:outputText style="float:left;width:55%;margin-left:2%;" value=" NGƯỜI GỬI : #{loginSession.login.hoten}"/>
                        <h:graphicImage style="float:left;width:3%;" styleClass="abcdelete" value="../images/delete_1.png"/>
                    </div>
                </h:panelGroup>
                <div class="inputSMS">
                    <div style="width: 20%;text-align: right;float: left;"><h:outputText value="Thêm SDT :"/></div>
                    <div style="width: 80%;text-align: left;float: left;"><h:inputText style="width:87.5%;" value="#{templateController.addnumbersms}"/></div>
                </div>
                <div class="inputSMS">
                    <div style="width: 20%;text-align: right;float: left;"><h:outputText value="Thông tin gửi :"/></div>
                    <div style="width: 80%;text-align: left;float: left;"><h:inputText style="width:87.5%;" value="#{templateController.cv052}"/></div>
                </div>
                <div class="inputSMS">
                    <div style="width: 20%;text-align: right;float: left;"><h:outputText value="Chọn dịch vụ :"/></div>
                    <div style="width: 80%;text-align: left;float: left;">
                        <h:selectOneMenu value="#{templateController.flagncc}">
                            <f:selectItem itemLabel="FIBO" itemValue="1"/>
                            <f:selectItem itemLabel="BEYU" itemValue="2"/>
                            <a4j:support event="onchange" actionListener="#{templateController.changeSuppliersms}" reRender="sendsms"/>
                        </h:selectOneMenu>
                    </div>
                </div>
                <div class="inputSMS">
                    <div style="width: 20%;text-align: right;float: left;"><h:outputText value="Template SMS :"/></div>
                    <div style="width: 80%;text-align: left;float: left;">
                        <h:selectOneMenu style="width:87.5%;height:25px;" value="#{templateController.pc050}">
                            <f:selectItem itemLabel="---------" itemValue="0"/> 
                            <f:selectItems value="#{m010Controller.combolistM010}"/>
                            <a4j:support event="onchange"  actionListener="#{templateController.onchangeTemplate}" reRender="template,template1,tem,tem1,tem2" />
                        </h:selectOneMenu>

                    </div>
                </div>

                <h:panelGroup id="template1">
                    <h:panelGroup rendered="#{templateController.pc050!=0}">
                        <div class="inputSMS">
                            <div style="width: 100%;text-align: center;float: left;color: yellow;">

                                <h:panelGroup rendered="#{templateController.pc050==3}">
                                    <span >
                                        Note : Chỉ thay đổi {P1} và {P2}.Nếu thay đổi sai Nhân Viên tự chịu trách nhiệm...Yêu cầu tin nhắn không có dấu
                                    </span>
                                </h:panelGroup>
                                <h:panelGroup rendered="#{templateController.pc050==4}">
                                    <span >
                                        Note : Chỉ thay đổi {P3},{P4} và {P5}.Nếu thay đổi sai Nhân Viên tự chịu trách nhiệm...Yêu cầu tin nhắn không có dấu
                                    </span>
                                </h:panelGroup>
                                <h:panelGroup rendered="#{templateController.pc050==5}">
                                    <span >
                                        Note : Chỉ thay đổi {P1},{P2},{P3},{P4},{P5},{P6},{P7}.Nếu thay đổi sai Nhân Viên tự chịu trách nhiệm...Yêu cầu tin nhắn không có dấu
                                    </span>
                                </h:panelGroup>
                                <h:panelGroup rendered="#{templateController.pc050==6}">
                                    <span >
                                        Note : Chỉ thay đổi {P2} và {P3}.Nếu thay đổi sai Nhân Viên tự chịu trách nhiệm...Yêu cầu tin nhắn không có dấu

                                    </span>
                                </h:panelGroup>

                            </div>
                        </div>
                    </h:panelGroup>
                </h:panelGroup>   
                <div class="inputSMS1">
                    <div style="width: 20%;text-align: right;float: left;"><h:outputText style="width:100%;float:left;" value="Nội dung :"/>
                        <h:outputText style="margin-right:6px;color:yellow" id="sgt_sms_warming" styleClass="sgt_sms_warming"  value="Còn #{templateController.countchar} kí tự"/>
                    </div>

                    <div style="width:80%;text-align: left;float: left;">
                        <h:panelGroup id="template">

                            <h:inputTextarea style="width:95%;height:100px;margin-left: 9px;" onkeyup="countChar(this)"  styleClass="abc" value="#{templateController.cv051}"/>
                        </h:panelGroup>

                    </div>
                </div>
                <h:inputHidden value="#{templateController.page}" id="smspage" />
                <h:inputHidden value="#{templateController.group}"  />
                <h:inputHidden value="#{templateController.phone}"  />                    
                <h:inputHidden value="#{templateController.fn100}"  />
                <h:inputHidden value="#{templateController.fk100}"  />

                <div><h:outputLabel value="Bạn đã vượt quá số kí tự cho phép" styleClass="sms_alert displaynone" /></div>
               
                    <div class="inputSMS hiddenSend">

                        <a4j:commandButton style="float:right;" value="SEND" reRender="reload4" actionListener="#{templateController.sgtSendSMS}"/>                             

                    </div>
               
               
                <rich:modalPanel styleClass="pleaseimage" id="statPane" autosized="true" minHeight="10" minWidth="80"
                                 height="10" width="80" zindex="2000">
                    <h:graphicImage value="/images/loadingAnimation.gif" alt="ai" />
                </rich:modalPanel>
            </a4j:form>
        </f:view>

    </body>
</html>
